/*
 * @Copyright: Copyright (c) 2030 吴周海
 * @Author: wzh200x@126.com
 * @Date: 2025-10-09 14:21:39
 * @LastEditors: wzh200x@126.com
 * @LastEditTime: 2025-10-09 14:22:02
 * @FilePath: \goWebServer\goGameWebServer\internal\interfaces\interface_database.go
 * @Description: 文件功能描述
 */
package interfaces

import (
	"database/sql"
	"goGameWebServer/internal/common/database/entityHelper"

	"github.com/gogf/gf/v2/database/gdb"
)

type IDataBase interface {
	// Init 初始化
	Init()
	// Name 获取数据库名称
	Name() string
	// GroupName 获取数据库组名
	GroupName() string
	GetPrefix() string
	// 同步数据库表结构
	SyncTable() error
	// GetDb 获取数据库操作对象
	GetDb() gdb.DB
	// SaveDataWithMap 保存数据到数据库 tableName 表名 data 数据 类型 Map
	SaveDataWithMap(data gdb.Map, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	SaveDataWithStruct(data interface{}, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	SaveMultiDataWithListMap(data gdb.List, batch int, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	InsertDataWithMap(data gdb.Map, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	InsertDataWithStruct(data interface{}, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	InsertDataWithListMap(data gdb.List, batch int, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	InsertDataWithMapAndGetId(data gdb.Map, tableNameOrStruct ...interface{}) (lastInsertId int64, err error)
	InsertDataWithStructAndGetId(data interface{}, tableNameOrStruct ...interface{}) (lastInsertId int64, err error)
	ReplaceDataWithMap(data gdb.Map, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	ReplaceDataWithStruct(data interface{}, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	ReplaceDataWithListMap(data gdb.List, batch int, tableNameOrStruct ...interface{}) (result sql.Result, err error)
	UpdateEntityData(entityName string, entityData *entityHelper.DBEntity)
}
